package com.boot.sample.mybatis.controller;

import com.boot.sample.mybatis.domain.AccessLog;
import com.boot.sample.mybatis.mapper.AccessLogMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

@Controller
@RequestMapping(value = "accesslog")
public class AccessLogController {
    @Autowired
    private AccessLogMapper accessLogMapper;
    @RequestMapping("")
    public String index(Long no,Model m) {

        List<AccessLog> list = new ArrayList<AccessLog>();
        AccessLog item = accessLogMapper.findById(no);
        if(null != item){
            list.add(item);
        }

        m.addAttribute("list",list);
        return "access_log";
    }

}
